/******************************************************************************
* File Name          : minimu_v2.h.h
* Author             :
* Author             :
* Version            : 1.0
* Date               : 5/11/2013
* Description        : Descriptor Header for l3gd20d driver file
*
* HISTORY:
* Date        | Modification                                | Author

*******************************************************************************/

/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __MINIMU_V2
#define __MINIMU_V2

/* Includes ------------------------------------------------------------------*/
#include <assert.h>
#include <math.h>
#include <float.h>
#include <string.h>
#include <stdio.h>
#include "l3gd20.h"
#include "lsm303dlhc.h"
#include "bmp085.h"
/* Exported types ------------------------------------------------------------*/
#ifndef PI
#define PI					3.14159265358979f
#endif
//these could change accordingly with the architecture

#ifndef __ARCHDEP__TYPES
#define __ARCHDEP__TYPES
typedef unsigned char u8_t;
typedef unsigned short int u16_t;
typedef short int i16_t;
typedef signed char i8_t;
typedef float float32_t;
#endif /*__ARCHDEP__TYPES*/

typedef u8_t L3GD20_Int1PinConf_t;
typedef u8_t L3GD20_Int2PinConf_t;
typedef u8_t L3GD20_Int1Conf_t;
typedef u8_t L3GD20_Axis_t;
/* Exported common structure --------------------------------------------------------*/

#ifndef __SHARED__TYPES
#define __SHARED__TYPES

typedef enum {
  MEMS_SUCCESS				=		0x01,
  MEMS_ERROR				=		0x00
} status_t;

typedef enum {
  MEMS_ENABLE				=		0x01,
  MEMS_DISABLE				=		0x00
} State_t;

typedef struct {
  float32_t AXIS_X;
  float32_t AXIS_Y;
  float32_t AXIS_Z;
} AxesRaw_t;

#endif /*__SHARED__TYPES*/
/* Exported macros -----------------------------------------------------------*/
/* Exported constants --------------------------------------------------------*/
#define MAG_DECLINATION      -7.6
/* Exported functions --------------------------------------------------------*/
void MinIMU_V2_Init();
void WhoAmI(u8_t* Data);
void AHRS();
void updateDCM();
status_t getOrientationString(char *string);
void offsetCalc();
void magCal();
void accCal();
void gyroCal();

#endif /* __MINIMU_V2_H */

/***************************************************************END OF FILE****/
